package jimmy.com;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.GridView;
import android.widget.Toast;
import android.widget.AdapterView.OnItemClickListener;

public class ProductsPage extends Activity{
	private ProductAdapter adapter;
	private GridView gridview;
	public void onCreate(Bundle savedInstanceState) {
	    super.onCreate(savedInstanceState);
	    setContentView(R.layout.productspage);

	    gridview = (GridView) findViewById(R.id.gridview);
	    adapter=new ProductAdapter(this, imageurls, namelist, commentnums, fitnums);
	    gridview.setAdapter(adapter);
	}
    public void onDestroy()
    {
        adapter.imageLoader.stopThread();
        gridview.setAdapter(null);
        
        super.onDestroy();            
        //adapter.imageLoader.clearCache();
        //adapter.notifyDataSetChanged();
    }
    // fake data
    private String[] imageurls={
    		"http://a1.twimg.com/profile_images/349012784/android_logo_small_normal.jpg",
    		"http://www.csie.ntu.edu.tw/~b97066/bag.jpg",
    		"http://www.csie.ntu.edu.tw/~b97066/bag.jpg",
    		"http://www.csie.ntu.edu.tw/~b97066/bag.jpg",
    		"http://www.csie.ntu.edu.tw/~b97066/bag.jpg",
    		"http://www.csie.ntu.edu.tw/~b97066/bag.jpg"
    };
    private String[] namelist={"tshirt1","tshirt2","tshirt3","tshirt4","tshirt5","tshirt6"};
    private int[] commentnums = {2,3,4,5,6,7};
    private int[] fitnums = {1,4,2,5,6,3};
}
